<?php

namespace App\Models\Admin;
//
// +---------------------------------------------------------+
// | 开发组
// +---------------------------------------------------------+
// | Copyrigh  (c)  2020 The PHP Group
// +---------------------------------------------------------+
// | 后台用户表
// +---------------------------------------------------------+
// | zxc
// | php后端开发
// |
// +———————————————————+
//

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Session;

class Area extends Model
{

    protected $table = 'area';
    protected $primaryKey = 'id';
    protected $dateFormat = 'U'; // 时间戳
    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s'
    ];

    /**
     * 获取身份数据
     * @return array
     */
    public static function getProvinceByExpress()
    {
        $list = self::where(['level' => 1])->get();
        foreach ($list as $kk => $vv) {
            $data[$kk]['area_id'] = $vv['id'];
            $data[$kk]['area_name'] = $vv['name'];
            $data[$kk]['first_unit'] = 4;
            $data[$kk]['two_unit'] = 2;
        }
        return $data;
    }
}